<?php
	function displayPage()
	{
		if(post('aoi6637') == 'null')
		{
			$selectTopic = '
			<select name="topic" class="inqForm">
				<option value="Corporate Information">Corporate Information</option>
				<option value="Bazaars & Events">Bazaars & Events</option>
				<option value="Promos">Promos</option>
				<option value="Product Inquiry">Product Inquiry</option>
				<option value="Size Request">Size Request</option>
				<option value="Press">Press</option>
				<option value="Comments & Suggestions">Comments & Suggestions</option>
			</select>
			';
			$view = '
			<b>Note:</b> Please complete all the fields with below before sending your message. Only inquiries with valid email addresses will be received.
					<br /><br />
					<table>
					<form method="POST" action="'.INDEX.'contact">
						<input type="hidden" value="yes" name="aoi6637" />
						<tr>
							<td class="labels">
								NAME:
							</td>
							<td class="data">
								<input type="text" name="clientName" class="inqForm"/>
							</td>
						</tr>
						<tr>
							<td class="labels">
								MOBILE:
							</td>
							<td class="data">
								<input type="text" name="tel" class="inqForm" />
							</td>
						</tr>
						<tr>
							<td class="labels">
								EMAIL:
							</td>
							<td class="data">
								<input type="text" name="email" class="inqForm"/>
							</td>
						</tr>
						<tr>
							<td class="labels">
								TOPIC:
							</td>
							<td class="data">
								'.$selectTopic.'
							</td>
						</tr>
						<tr>
							<td class="labels">
								SUBJECT:
							</td>
							<td class="data">
								<input type="text" name="subj" class="inqForm"/>
							</td>
						</tr>
						<tr>
							<td colspan="2" class="last">
								<div class="labels">MESSAGE:</div>
								<textarea id="inqText" name="inquiry"></textarea>
							</td>
						</tr>
						<tr>
							<td colspan="2" class="submit centerAlign">
								<input type="submit" value="Send Inquiry" id="submitBtn" />
							</td>
						</tr>
					</form>
					</table>
			';
		}
		else{
			//sendemail here.
			if(post('clientName') == '' || post('tel') == '' || post('email') == '' || post('subj') == '' || post('inquiry') == '' || get('fail') == 'yes')
			{
				$view = '
				<b>Note:</b> There was an error in sending your inquiry. Some of the fields were left empty. Please fill them up with the necessary values.
						<br /><br />
						<table>
						<form method="POST" action="'.INDEX.'contact">
							<input type="hidden" value="yes" name="aoi6637" />
							<tr>
								<td class="labels">
									NAME:
								</td>
								<td class="data">
									<input type="text" name="clientName" class="inqForm" value="'.post('clientName').'"/>
								</td>
							</tr>
							<tr>
								<td class="labels">
									MOBILE:
								</td>
								<td class="data">
									<input type="text" name="tel" class="inqForm" value="'.post('tel').'" />
								</td>
							</tr>
							<tr>
								<td class="labels">
									EMAIL:
								</td>
								<td class="data">
									<input type="text" name="email" class="inqForm" value="'.post('email').'"/>
								</td>
							</tr>
							<tr>
								<td class="labels">
									TOPIC:
								</td>
								<td class="data">
									'.$selectTopic.'
								</td>
							</tr>
							<tr>
								<td class="labels">
									SUBJECT:
								</td>
								<td class="data">
									<input type="text" name="subj" class="inqForm" value="'.post('subj').'"/>
								</td>
							</tr>
							<tr>
								<td colspan="2" class="last">
									<div class="labels">MESSAGE:</div>
									<textarea id="inqText" name="inquiry">'.post('inquiry').'</textarea>
								</td>
							</tr>
							<tr>
								<td colspan="2" class="submit centerAlign">
									<input type="submit" value="Send Inquiry" id="submitBtn" />
								</td>
							</tr>
						</form>
						</table>
				';
			}
			else
			{
				$v = '
				<b>Note:</b> There was an error in sending your inquiry. An invalid email address format has been entered.
						<br /><br />
						<table>
						<form method="POST" action="'.INDEX.'contact">
							<input type="hidden" value="yes" name="aoi6637" />
							<tr>
								<td class="labels">
									NAME:
								</td>
								<td class="data">
									<input type="text" name="clientName" class="inqForm" value="'.post('clientName').'"/>
								</td>
							</tr>
							<tr>
								<td class="labels">
									MOBILE:
								</td>
								<td class="data">
									<input type="text" name="tel" class="inqForm" value="'.post('tel').'" />
								</td>
							</tr>
							<tr>
								<td class="labels">
									EMAIL:
								</td>
								<td class="data">
									<input type="text" name="email" class="inqForm" value="'.post('email').'"/>
								</td>
							</tr>
							<tr>
								<td class="labels">
									TOPIC:
								</td>
								<td class="data">
									'.$selectTopic.'
								</td>
							</tr>
							<tr>
								<td class="labels">
									SUBJECT:
								</td>
								<td class="data">
									<input type="text" name="subj" class="inqForm" value="'.post('subj').'"/>
								</td>
							</tr>
							<tr>
								<td colspan="2" class="last">
									<div class="labels">MESSAGE:</div>
									<textarea id="inqText" name="inquiry">'.post('inquiry').'</textarea>
								</td>
							</tr>
							<tr>
								<td colspan="2" class="submit centerAlign">
									<input type="submit" value="Send Inquiry" id="submitBtn" />
								</td>
							</tr>
						</form>
						</table>
				';
				
				$inquirySender = 'Topic: '.post('topic').'<br /><br />'.post('inquiry');
				$view = sendThisEmail(genericEmailFormat(post('clientName'), post('tel'), post('email'), $inquirySender, 'Sole Service Contact Form'), post('subj'), 'Your inquiry has been sent. We will reply to your inquiry shortly via the email address you specified. Click <a href="'.INDEX.'contact"><b>here</b></a> to go back.', $v, 'inquiry@soleservice.com.ph', post('email'), verifyEmail(post('email')));
				
/* 				$view = 'send/verify mail - test online remove this comment lol thanks.'; */
			}	
		}
		$output = '
		<div id="mainDiv" class="container_12">
			<div class="grid_12">
				<h2>Contact Us</h2>
			</div>
			<div class="clear">
			<!--spanner-->
			</div>
			<div id="linkList" class="grid_3">
				<ul>
					<li><a href="'.INDEX.'about">About</a></li>
					<li><a href="'.INDEX.'guide">Size Guide</a></li>
					<li><a href="'.INDEX.'shipping">Shipping</a></li>
					<li><a href="'.INDEX.'terms">Terms &amp; Conditions</a></li>
					<li><a href="'.INDEX.'contact">Contact Us</a></li>
				</ul>
			</div>
			<div id="contentList" class="grid_9"'.(get('jump') == 1 ? ' alt="mainDelPg"' : '').'>
				<div class="contentBox">
					'.$view.'
				</div> 
			</div>
		</div>
		';
		return $output;
	}
?>